package com.glamour.hlcity.common.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.glamour.hlcity.common.util.ListUtil;

/**
 * 节点
 * @author zhaoxing.liuzx
 *
 */
public class Node {
	/**
	 * 图像
	 */
	public final static  String LINK_NODE_TYPE_IMG="image";
	
	/**
	 * 链接
	 */
	public final static  String LINK_NODE_TYPE_HREF="href";
	
	/**
	 * iframe
	 */
	public final static  String LINK_NODE_TYPE_FRAME="iframe";
	
	/**
	 * HTML ELEMENT TAG
	 */
	public final static  String HTML_ELEMENT_TAG="html_element_tag";
	
	/**
	 * HTML ELEMENT TEXT
	 */
	public final static  String HTML_ELEMENT_TEXT="html_element_text";
	
	/**
	 *  url链接以'/'分段开来的url链接部分
	 */
	public final static String LINK_NODE_TYPE_HREF_PART_TEXT="href_part_text";
	
	/**
	 * 节点标示
	 */
	private String nodeNo;
	
	/**
	 * 节点名称
	 */
	private String nodeName;
	
	/**
	 * 节点类型
	 */
	private String nodeType;
	
	/**
	 * 节点父亲节点的标示
	 */
	private String parentNodeNo;
	
	/**
	 * 父亲节点
	 */
	private Node parentNode;
	
	/**
	 * 层次 默认从1开始
	 */
	private Integer level;
	
	/**
	 * 顺序 默认从1开始
	 */
	private Integer siber;
	
	/**
	 * 子节点
	 */
	private List<Node> childNodes;
	
	/**
	 * 描述
	 */
	private String text;
	


	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Node(String nodeNo, String nodeName, String parentNodeNo) {
		super();
		this.nodeNo = nodeNo;
		this.nodeName = nodeName;
		this.parentNodeNo = parentNodeNo;
	}
	
	public Node(String nodeNo, String nodeName) {
		super();
		this.nodeNo = nodeNo;
		this.nodeName = nodeName;
	}


	public Node(String nodeNo) {
		super();
		this.nodeNo = nodeNo;
	}


	public Node() {
		super();
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public Node getParentNode() {
		return parentNode;
	}

	public void setParentNode(Node parentNode) {
		this.parentNode = parentNode;
	}



	public List<Node> getChildNodes() {
		if(childNodes==null){
			return ListUtil.emptyList();
		}
		return childNodes;
	}

	public void setChildNodes(List<Node> childNodes) {
		this.childNodes = childNodes;
	}

	public String getNodeNo() {
		return nodeNo;
	}

	public void setNodeNo(String nodeNo) {
		this.nodeNo = nodeNo;
	}

	public String getNodeName() {
		return nodeName;
	}

	public void setNodeName(String nodeName) {
		this.nodeName = nodeName;
	}

	public String getNodeType() {
		return nodeType;
	}

	public void setNodeType(String nodeType) {
		this.nodeType = nodeType;
	}

	public String getParentNodeNo() {
		return parentNodeNo;
	}

	public void setParentNodeNo(String parentNodeNo) {
		this.parentNodeNo = parentNodeNo;
	}
	
	/**
	 * 新增子节点
	 * @param node
	 */
	public void addChildNode(Node node){
		if(childNodes==null){
			childNodes=new ArrayList<Node>();
		}
		if(node!=null){
			childNodes.add(node);
		}
	}

	public Integer getSiber() {
		return siber;
	}

	public void setSiber(Integer siber) {
		this.siber = siber;
	}
	
	
	
	

}
